package com.hiqtech.complex.entity;

public class ComplexUtil {
	
	/**
	 * Absolute value of array of complex numbers.
	 * 
	 * @param in array of complex numbers
	 * @return
	 */
	public static double[] absArray(Complex[] in){
		double[] out = new double[in.length];
		for (int i = 0; i < in.length; i++){
			out[i] = in[i].abs();
		}
		return out;
	}
	
	public static Complex[] randomArray(int size, double maxArg){
		Complex[] out = new Complex[size];
		for (int i = 0; i < size; i++){
			out[i] = Complex.exp(Math.random() * maxArg);
		}
		return out;
	}
	
	public static Complex[] randomArray(int size){
		return randomArray(size, 1);
	}
}
